home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / monitor / xwait.c < prev   
Encoding:
C/C++ Source or Header  |  1985-01-23  |  926 b   |  58 lines

  1. # include    "monitor.h"
  2. # include    <ingres.h>
  3. # include    <aux.h>
  4. # include    <sccs.h>
  5.  
  6. SCCSID(@(#)xwait.c    8.1    12/31/84)
  7.  
  8.  
  9.  
  10. /*
  11. **  WAIT FOR PROCESS TO DIE
  12. **
  13. **    Used in edit() and shell() to terminate the subprocess.
  14. **    Waits on pid "Xwaitpid".  If this is zero, xwait() returns
  15. **    immediately.
  16. **
  17. **    This is called by "catchsig()" so as to properly terminate
  18. **    on a rubout while in one of the subsystems.
  19. **
  20. **    Trace Flags:
  21. **        41
  22. */
  23.  
  24. xwait()
  25. {
  26.     int        status;
  27.     register int    i;
  28.     register char    c;
  29.  
  30. #    ifdef xMTR2
  31.     if (tTf(41, 0))
  32.         printf("xwait: [%d]\n", Xwaitpid);
  33. #    endif
  34.     if (Xwaitpid == 0)
  35.     {
  36.         cgprompt();
  37.         return;
  38.     }
  39.     while ((i = wait(&status)) != -1)
  40.     {
  41. #        ifdef xMTR2
  42.         if (tTf(41, 1))
  43.             printf("pid %d stat %d\n", i, status);
  44. #        endif
  45.         if (i == Xwaitpid)
  46.             break;
  47.     }
  48.  
  49.     Xwaitpid = 0;
  50.  
  51.     /* reopen query buffer */
  52.     if ((Qryiop = fopen(Qbname, "a")) == NULL)
  53.         syserr("xwait: open %s", Qbname);
  54.     Notnull = 1;
  55.  
  56.     cgprompt();
  57. }
  58.